package com.ibeeking.found.common.enums.goods;

import com.ibeeking.nematos.utils.data.StringUtils;

/**
 * @Author ibeeking
 * @Date: 2021-01-05 19:15
 * @Description: 商品状态enum
 */
public enum GoodsStatusEnum {
    //商品状态：-1草稿、-2待审核、-3下架、-4已上架、-5已停售
    DRAFT(1, "草稿"),
    TO_BE_APPROVED(2,"待审核"),
    OFF_SHELF(3,"下架"),
    ON_SHELF(4,"已上架"),
    STOP_SELL(5,"已停售"),;
    private Integer value;
    private String desc;

    GoodsStatusEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }


    public Integer getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static GoodsStatusEnum getEnum(Integer value) {
        for (GoodsStatusEnum enumObj : values()) {
            if (enumObj.getValue().equals(value)) {
                return enumObj;
            }
        }
        return null;
    }

    public static String getEnumDesc(Integer value) {
        for (GoodsStatusEnum enumObj : values()) {
            if (enumObj.getValue().equals(value)) {
                return enumObj.getDesc();
            }
        }
        return StringUtils.EMPTY;
    }
}
